home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / Lists.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  11.5 KB  |  312 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Lists.h
  3.  
  4.      Contains:    List Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1.3
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __LISTS__
  21. #define __LISTS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __CONTROLS__
  30. #include <Controls.h>
  31. #endif
  32. /*    #include <Quickdraw.h>                                        */
  33. /*        #include <MixedMode.h>                                    */
  34. /*        #include <QuickdrawText.h>                                */
  35. /*    #include <Menus.h>                                            */
  36. /*        #include <Memory.h>                                        */
  37.  
  38. #ifndef __MEMORY__
  39. #include <Memory.h>
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_ALIGN_SUPPORTED
  47. #pragma options align=mac68k
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT_SUPPORTED
  51. #pragma import on
  52. #endif
  53.  
  54. enum {
  55.     lDoVAutoscroll                = 2,
  56.     lDoHAutoscroll                = 1,
  57.     lOnlyOne                    = -128,
  58.     lExtendDrag                    = 64,
  59.     lNoDisjoint                    = 32,
  60.     lNoExtend                    = 16,
  61.     lNoRect                        = 8,
  62.     lUseSense                    = 4,
  63.     lNoNilHilite                = 2
  64. };
  65.  
  66. enum {
  67.     lDoVAutoscrollBit            = 1,
  68.     lDoHAutoscrollBit            = 0,
  69.     lOnlyOneBit                    = 7,
  70.     lExtendDragBit                = 6,
  71.     lNoDisjointBit                = 5,
  72.     lNoExtendBit                = 4,
  73.     lNoRectBit                    = 3,
  74.     lUseSenseBit                = 2,
  75.     lNoNilHiliteBit                = 1
  76. };
  77.  
  78.  
  79. enum {
  80.     lInitMsg                    = 0,
  81.     lDrawMsg                    = 1,
  82.     lHiliteMsg                    = 2,
  83.     lCloseMsg                    = 3
  84. };
  85.  
  86. typedef struct ListRec ListRec, *ListPtr, **ListHandle;
  87.  
  88. typedef ListHandle ListRef;
  89.  
  90. typedef Point Cell;
  91.  
  92. typedef Rect ListBounds;
  93.  
  94. typedef char DataArray[32001];
  95.  
  96. typedef char *DataPtr, **DataHandle;
  97.  
  98. typedef pascal short (*ListSearchProcPtr)(Ptr aPtr, Ptr bPtr, short aLen, short bLen);
  99. /*
  100.         ListClickLoopProcPtr uses register based parameters on the 68k and cannot
  101.         be written in or called from a high-level language without the help of
  102.         mixed mode or assembly glue.
  103.  
  104.             typedef pascal Boolean (*ListClickLoopProcPtr)(void);
  105.  
  106.         In:
  107.          =>                 .?
  108.         Out:
  109.          <= return value    D0.B
  110. */
  111.  
  112. #if GENERATINGCFM
  113. typedef UniversalProcPtr ListSearchUPP;
  114. typedef UniversalProcPtr ListClickLoopUPP;
  115. #else
  116. typedef ListSearchProcPtr ListSearchUPP;
  117. typedef Register68kProcPtr ListClickLoopUPP;
  118. #endif
  119.  
  120. struct ListRec {
  121.     Rect                            rView;
  122.     GrafPtr                            port;
  123.     Point                            indent;
  124.     Point                            cellSize;
  125.     ListBounds                        visible;
  126.     ControlRef                        vScroll;
  127.     ControlRef                        hScroll;
  128.     SInt8                            selFlags;
  129.     Boolean                            lActive;
  130.     SInt8                            lReserved;
  131.     SInt8                            listFlags;
  132.     long                            clikTime;
  133.     Point                            clikLoc;
  134.     Point                            mouseLoc;
  135.     ListClickLoopUPP                lClickLoop;
  136.     Cell                            lastClick;
  137.     long                            refCon;
  138.     Handle                            listDefProc;
  139.     Handle                            userHandle;
  140.     ListBounds                        dataBounds;
  141.     DataHandle                        cells;
  142.     short                            maxIndex;
  143.     short                            cellArray[1];
  144. };
  145.  
  146. typedef pascal void (*ListDefProcPtr)(short lMessage, Boolean lSelect, Rect *lRect, Cell lCell, short lDataOffset, short lDataLen, ListRef lHandle);
  147. typedef pascal void (*ListCellDrawProcPtr)(short lMessage, Boolean lSelect, Rect *lRect, Cell lCell, void *dataPtr, short lDataLen, ListRef lHandle);
  148.  
  149. #if GENERATINGCFM
  150. typedef UniversalProcPtr ListDefUPP;
  151. typedef UniversalProcPtr ListCellDrawUPP;
  152. #else
  153. typedef ListDefProcPtr ListDefUPP;
  154. typedef ListCellDrawProcPtr ListCellDrawUPP;
  155. #endif
  156.  
  157. enum {
  158.     uppListSearchProcInfo = kPascalStackBased
  159.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  160.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  161.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  162.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  163.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short))),
  164.     uppListClickLoopProcInfo = kRegisterBased
  165.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  166.          | REGISTER_RESULT_LOCATION(kRegisterD0),
  167.     uppListDefProcInfo = kPascalStackBased
  168.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  169.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
  170.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
  171.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Cell)))
  172.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(short)))
  173.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(short)))
  174.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(ListRef))),
  175.     uppListCellDrawProcInfo = kPascalStackBased
  176.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  177.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
  178.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
  179.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Cell)))
  180.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
  181.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(short)))
  182.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(ListRef)))
  183. };
  184.  
  185. #if GENERATINGCFM
  186. #define NewListSearchProc(userRoutine)        \
  187.         (ListSearchUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppListSearchProcInfo, GetCurrentArchitecture())
  188. #define NewListClickLoopProc(userRoutine)        \
  189.         (ListClickLoopUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppListClickLoopProcInfo, GetCurrentArchitecture())
  190. #define NewListDefProc(userRoutine)        \
  191.         (ListDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppListDefProcInfo, GetCurrentArchitecture())
  192. #define NewListCellDrawProc(userRoutine)        \
  193.         (ListCellDrawUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppListCellDrawProcInfo, GetCurrentArchitecture())
  194. #else
  195. #define NewListSearchProc(userRoutine)        \
  196.         ((ListSearchUPP) (userRoutine))
  197. #define NewListClickLoopProc(userRoutine)        \
  198.         ((ListClickLoopUPP) (userRoutine))
  199. #define NewListDefProc(userRoutine)        \
  200.         ((ListDefUPP) (userRoutine))
  201. #define NewListCellDrawProc(userRoutine)        \
  202.         ((ListCellDrawUPP) (userRoutine))
  203. #endif
  204.  
  205. #if GENERATINGCFM
  206. #define CallListSearchProc(userRoutine, aPtr, bPtr, aLen, bLen)        \
  207.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppListSearchProcInfo, (aPtr), (bPtr), (aLen), (bLen))
  208. #define CallListClickLoopProc(userRoutine)        \
  209.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppListClickLoopProcInfo)
  210. #define CallListDefProc(userRoutine, lMessage, lSelect, lRect, lCell, lDataOffset, lDataLen, lHandle)        \
  211.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppListDefProcInfo, (lMessage), (lSelect), (lRect), (lCell), (lDataOffset), (lDataLen), (lHandle))
  212. #define CallListCellDrawProc(userRoutine, lMessage, lSelect, lRect, lCell, dataPtr, lDataLen, lHandle)        \
  213.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppListCellDrawProcInfo, (lMessage), (lSelect), (lRect), (lCell), (dataPtr), (lDataLen), (lHandle))
  214. #else
  215. #define CallListSearchProc(userRoutine, aPtr, bPtr, aLen, bLen)        \
  216.         (*(userRoutine))((aPtr), (bPtr), (aLen), (bLen))
  217. /* (*ListClickLoopProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  218. #define CallListDefProc(userRoutine, lMessage, lSelect, lRect, lCell, lDataOffset, lDataLen, lHandle)        \
  219.         (*(userRoutine))((lMessage), (lSelect), (lRect), (lCell), (lDataOffset), (lDataLen), (lHandle))
  220. #define CallListCellDrawProc(userRoutine, lMessage, lSelect, lRect, lCell, dataPtr, lDataLen, lHandle)        \
  221.         (*(userRoutine))((lMessage), (lSelect), (lRect), (lCell), (dataPtr), (lDataLen), (lHandle))
  222. #endif
  223.  
  224. extern pascal ListRef LNew(const Rect *rView, const ListBounds *dataBounds, Point cSize, short theProc, WindowRef theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert)
  225.  THREEWORDINLINE(0x3F3C, 0x0044, 0xA9E7);
  226. extern pascal void LDispose(ListRef lHandle)
  227.  THREEWORDINLINE(0x3F3C, 0x0028, 0xA9E7);
  228. extern pascal short LAddColumn(short count, short colNum, ListRef lHandle)
  229.  THREEWORDINLINE(0x3F3C, 0x0004, 0xA9E7);
  230. extern pascal short LAddRow(short count, short rowNum, ListRef lHandle)
  231.  THREEWORDINLINE(0x3F3C, 0x0008, 0xA9E7);
  232. extern pascal void LDelColumn(short count, short colNum, ListRef lHandle)
  233.  THREEWORDINLINE(0x3F3C, 0x0020, 0xA9E7);
  234. extern pascal void LDelRow(short count, short rowNum, ListRef lHandle)
  235.  THREEWORDINLINE(0x3F3C, 0x0024, 0xA9E7);
  236. extern pascal Boolean LGetSelect(Boolean next, Cell *theCell, ListRef lHandle)
  237.  THREEWORDINLINE(0x3F3C, 0x003C, 0xA9E7);
  238. extern pascal Cell LLastClick(ListRef lHandle)
  239.  THREEWORDINLINE(0x3F3C, 0x0040, 0xA9E7);
  240. extern pascal Boolean LNextCell(Boolean hNext, Boolean vNext, Cell *theCell, ListRef lHandle)
  241.  THREEWORDINLINE(0x3F3C, 0x0048, 0xA9E7);
  242. extern pascal Boolean LSearch(const void *dataPtr, short dataLen, ListSearchUPP searchProc, Cell *theCell, ListRef lHandle)
  243.  THREEWORDINLINE(0x3F3C, 0x0054, 0xA9E7);
  244. extern pascal void LSize(short listWidth, short listHeight, ListRef lHandle)
  245.  THREEWORDINLINE(0x3F3C, 0x0060, 0xA9E7);
  246. extern pascal void LSetDrawingMode(Boolean drawIt, ListRef lHandle)
  247.  THREEWORDINLINE(0x3F3C, 0x002C, 0xA9E7);
  248. extern pascal void LScroll(short dCols, short dRows, ListRef lHandle)
  249.  THREEWORDINLINE(0x3F3C, 0x0050, 0xA9E7);
  250. extern pascal void LAutoScroll(ListRef lHandle)
  251.  THREEWORDINLINE(0x3F3C, 0x0010, 0xA9E7);
  252. extern pascal void LUpdate(RgnHandle theRgn, ListRef lHandle)
  253.  THREEWORDINLINE(0x3F3C, 0x0064, 0xA9E7);
  254. extern pascal void LActivate(Boolean act, ListRef lHandle)
  255.  TWOWORDINLINE(0x4267, 0xA9E7);
  256. extern pascal void LCellSize(Point cSize, ListRef lHandle)
  257.  THREEWORDINLINE(0x3F3C, 0x0014, 0xA9E7);
  258. extern pascal Boolean LClick(Point pt, short modifiers, ListRef lHandle)
  259.  THREEWORDINLINE(0x3F3C, 0x0018, 0xA9E7);
  260. extern pascal void LAddToCell(const void *dataPtr, short dataLen, Cell theCell, ListRef lHandle)
  261.  THREEWORDINLINE(0x3F3C, 0x000C, 0xA9E7);
  262. extern pascal void LClrCell(Cell theCell, ListRef lHandle)
  263.  THREEWORDINLINE(0x3F3C, 0x001C, 0xA9E7);
  264. extern pascal void LGetCell(void *dataPtr, short *dataLen, Cell theCell, ListRef lHandle)
  265.  THREEWORDINLINE(0x3F3C, 0x0038, 0xA9E7);
  266. extern pascal void LRect(Rect *cellRect, Cell theCell, ListRef lHandle)
  267.  THREEWORDINLINE(0x3F3C, 0x004C, 0xA9E7);
  268. extern pascal void LSetCell(const void *dataPtr, short dataLen, Cell theCell, ListRef lHandle)
  269.  THREEWORDINLINE(0x3F3C, 0x0058, 0xA9E7);
  270. extern pascal void LSetSelect(Boolean setIt, Cell theCell, ListRef lHandle)
  271.  THREEWORDINLINE(0x3F3C, 0x005C, 0xA9E7);
  272. extern pascal void LDraw(Cell theCell, ListRef lHandle)
  273.  THREEWORDINLINE(0x3F3C, 0x0030, 0xA9E7);
  274. extern pascal void LGetCellDataLocation(short *offset, short *len, Cell theCell, ListRef lHandle)
  275.  THREEWORDINLINE(0x3F3C, 0x0034, 0xA9E7);
  276. #if CGLUESUPPORTED
  277. extern void laddtocell(Ptr dataPtr, short dataLen, Cell *theCell, ListRef lHandle);
  278. extern void lclrcell(Cell *theCell, ListRef lHandle);
  279. extern void lgetcelldatalocation(short *offset, short *len, Cell *theCell, ListRef lHandle);
  280. extern void lgetcell(Ptr dataPtr, short *dataLen, Cell *theCell, ListRef lHandle);
  281. extern ListRef lnew(Rect *rView, ListBounds *dataBounds, Point *cSize, short theProc, WindowRef theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert);
  282. extern void lrect(Rect *cellRect, Cell *theCell, ListRef lHandle);
  283. extern void lsetcell(Ptr dataPtr, short dataLen, Cell *theCell, ListRef lHandle);
  284. extern void lsetselect(Boolean setIt, Cell *theCell, ListRef lHandle);
  285. extern void ldraw(Cell *theCell, ListRef lHandle);
  286. extern Boolean lclick(Point *pt, short modifiers, ListRef lHandle);
  287. extern void lcellsize(Point *cSize, ListRef lHandle);
  288. #endif
  289. #if OLDROUTINENAMES
  290. #define LDoDraw(drawIt, lHandle) LSetDrawingMode(drawIt, lHandle)
  291. #define LFind(offset, len, theCell, lHandle)  \
  292.     LGetCellDataLocation(offset, len, theCell, lHandle)
  293. #if CGLUESUPPORTED
  294. #define lfind(offset, len, theCell, lHandle)  \
  295.     lgetcelldatalocation(offset, len, theCell, lHandle)
  296. #endif
  297. #endif
  298.  
  299. #if PRAGMA_IMPORT_SUPPORTED
  300. #pragma import off
  301. #endif
  302.  
  303. #if PRAGMA_ALIGN_SUPPORTED
  304. #pragma options align=reset
  305. #endif
  306.  
  307. #ifdef __cplusplus
  308. }
  309. #endif
  310.  
  311. #endif /* __LISTS__ */
  312.